import { BaseEntity } from "../../base/entity/base";
import { Column, Entity } from "typeorm";

@Entity('payment_refund', { comment: '退款记录' })
export class PaymentRefundEntity extends BaseEntity {

    @Column({
        type: 'int',
        comment: '支付记录ID',
    })
    recordId: number;

    @Column({
        type: 'varchar',
        length: 255,
        comment: '商户退款单号',
    })
    no: string;


    @Column({
        type: 'varchar',
        length: 255,
        comment: '第三方平台退款单号',
    })
    thirdNo: string;

    @Column({
        dict: ['wxpay', 'alipay', 'bank', 'other'],
        default: 0,
        nullable: true,
        comment: '退款方式',
    })
    method: number;

    @Column({
        type: 'text',
        comment: '退款原因',
        nullable: true,
    })
    reason: string;


    @Column({
        type: 'enum',
        enum: ['processing', 'success', 'closed', 'abnormal'],
        default: 'processing',
        comment: '退款状态',
    })
    status: string;

    @Column({
        type: 'decimal',
        precision: 10,
        scale: 2,
        comment: '退款金额',
    })
    amount: number;

    @Column({
        type: 'datetime',
        nullable: true,
        comment: '退款通知时间',
    })
    notifyTime: Date;

}